<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<!--<link href="../js/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">-->
		<link rel="stylesheet" type="text/css" href="../../../js/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
		<!--<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />-->
		<link rel="stylesheet" type="text/css" href="../../../css/footer.css" />
		<link rel="stylesheet" type="text/css" href="../../../css/gift_sell.css" />
		<script src="../../../js/flexible.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="../../../css/store_member/style.css" />
		<style type="text/css">
			.gift_sell_wap ul li {
				height: 4.3rem;
			}
			
			body {
				overflow: auto;
			}
			
			button.f28_s:focus {
				outline: none;
			}
			
			#top_scroll {
				position: fixed;
				bottom: 0.277777rem;
				right: 0.277777rem;
				z-index: 5;
				transition: all .5s;
			}
			
			/*#gift_main li p {
				position: relative;
				top: 0.277777rem;
			}*/
			
			.red_border {
				border-bottom: 1px solid red;
			}
			/*发货弹框*/
			
			.duihuan_box2 {
				display: none;
				width: 100%;
				height: 100%;
				position: fixed;
				top: 0;
				left: 0;
				background-color: rgba(0, 0, 0, 0.3);
			}
			
			.duihuan2 {
				width: 6.944444rem;
				height: 4.152777rem;
				background-color: white;
				margin: 0 auto;
				margin-top: 5rem;
				position: absolute;
				left: 50%;
				margin-left: -3.49rem;
			}
			
			.duihuan_top2 {
				font-size: 0.416666rem;
				color: #E8323E;
				text-align: center;
				padding-top: 0.888888rem;
				padding-bottom: 1.444444rem;
			}
			
			.duihuan_down2 {
				width: 5.902777rem;
				height: 1.388888rem;
				margin: 0 auto;
				border-top: 1px solid #DBDBDB;
			}
			
			.duihuan_down2 a {
				width: 2.013888rem;
				height: 0.694444rem;
				border: 1px solid #E8323E;
				margin-top: 0.208333rem;
				text-align: center;
				line-height: 0.694444rem;
				border-radius: 0.694444rem;
			}
			
			.duihuan_down2 a:nth-child(1) {
				float: left;
				color: white;
				background-color: #E8323E;
			}
			
			.duihuan_down2 a:nth-child(2) {
				float: right;
				color: #E8323E;
			}
			/*发货弹框*/
			
			.duihuan_box1 {
				
	display: none;
	width: 100%;
	height: 100%;
	position: fixed;
	top: 0;
	left: 0;
	background-color: rgba(0, 0, 0, 0.3);
}

.duihuan1 {
	width: 6.944444rem;
	height: 4.152777rem;
	background-color: white;
	margin: 0 auto;
	margin-top: 5rem;
	position: absolute;
	left: 50%;
	margin-left: -3.49rem;
}

.duihuan_top1 {
	font-size: 0.416666rem;
	color: #E8323E;
	text-align: center;
	padding-top: 0.888888rem;
	padding-bottom: 1.444444rem;
}

.duihuan_down1 {
	width: 5.902777rem;
	height: 1.388888rem;
	margin: 0 auto;
	border-top: 1px solid #DBDBDB;
}

.duihuan_down1 a {
	width: 2.013888rem;
	height: 0.694444rem;
	border: 1px solid #E8323E;
	margin-top: 0.208333rem;
	text-align: center;
	line-height: 0.694444rem;
	border-radius: 0.694444rem;
}

.duihuan_down1 a:nth-child(1) {
	float: left;
	color: white;
	background-color: #E8323E;
}

.duihuan_down1 a:nth-child(2) {
	float: right;
	color: #E8323E;
}			
/*div.yijimai{
	position: relative;
	top: 100px;
	height: 2rem;
}*/
		</style>
	</head>

	<body>
		<div id="wrap">
			<div id="main">
				<div id="header">
					<a id="headImg" href="javascript:history.go(-1)"><img class="headImg" src="../../../images/12.png" /></a>
					<p id="headTitle" style="box-shadow: none;">我的礼品</p>
				</div>
				<div class="nav" style="overflow: hidden;margin-top:1.3rem; background: #fff;">
					<div style="float: left;padding:0.2rem 0 0.2rem 0;  text-align: center; width: 33.3%;">
						<span id="type111" class="f28_s active_red red_border" style=" padding-bottom:0.2rem;" >全部</span>
					</div>
					<div style="float: left; padding:0.2rem 0 0.2rem 0;  text-align: center; width: 33.3%;">
						<span id="type222" class="f28_s " style="padding-bottom:0.2rem;" >未发货</span>
					</div>
					<div style="float: left; padding:0.2rem 0 0.2rem 0; text-align: center; width: 33.3%;">
						<span id="type333" class="f28_s " style="padding-bottom:0.2rem;">已购买</span>
					</div>
				</div>
				<div id="content">
					<div id="top_scroll" onclick="topScroll()">
						回到顶部
					</div>
					<div class="gift_sell_wap">
						<ul id="gift_main" style="margin-top:-5px;">
						</ul>
					</div>
				</div>
			</div>
		</div>
		<!--发货弹出框-->
		<div class="duihuan_box1">
			<div class="duihuan1">
				<div class="duihuan_top1">
					确定发货？
				</div>
				<div class="duihuan_down1">
					<a id="Besure1" style="cursor: pointer;" data-toggle="modal" data-target="#myModal">确定</a>
					<a href="#">取消</a>
				</div>
			</div>
		</div>
		<!--寄卖弹出框-->
		<div class="duihuan_box2">
			<div class="duihuan2">
				<div class="duihuan_top2">
					确定寄售？
				</div>
				<div class="duihuan_down2">
					<a id="Besure2" style="cursor: pointer;">确定</a>
					<a href="#">取消</a>
				</div>
			</div>
		</div>
		<!--输入收货地址框-->
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
				</button>
						<h4 class="modal-title" id="myModalLabel">
					编辑收货地址
				</h4>

					</div>
					<div class="modal-body">
						<input type="text" class="form-control" name="" id="addName" style="margin-bottom: 0.2rem;" placeholder="请输入联系人姓名" value="" />
						<input type="text" class="form-control" name="" id="phone" style="margin-bottom: 0.2rem;" placeholder="请输入联系人电话" value="" />
						<input type="text" class="form-control" name="" id="address" style="margin-bottom: 0.2rem;" placeholder="请输入详细地址" value="" />

					</div>
					<div class="modal-footer">
						<button type="button" id="fahuoQuxiao" class="btn btn-default" data-dismiss="modal">关闭
				</button>
						<button type="button" id="fahuoTrue" class="btn btn-danger">
					确定
				</button>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal-dialog -->
		</div>
		<!-- /.modal -->

	</body>
	<script src="../../../js/jquery-2.2.3.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../js/bootstrap-3.3.7-dist/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		//登陆判断
		var tokenReztApp = $.cookie("tokenReztApp");
		if(!tokenReztApp) {
			window.location.href = "../../login/login/login.html";
		}
		$(function() {
			currentyf();
		});

		//用户信息
		var user, role, goodsId;
		//获取当前会员信息
		function currentyf() {
			$.ajax({
				cache: false,
				type: "GET",
				url: "http://47.104.13.109/member-service/auth/current?token=" + tokenReztApp,
				dataType: "JSON",
				async: false,
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					$.removeCookie('tokenReztApp', {
						expires: 7,
						path: '/'
					});
					$.removeCookie("tokenRh", {
						expires: 7,
						path: '/'
					});
					$.removeCookie('memberId', {
						expires: 7,
						path: '/'
					});
					$.removeCookie('roleId', {
						expires: 7,
						path: '/'
					});
					window.location.href = "../../login/login/login.html";
				},
				success: function(data) {
					user = data.loginName;
					role = data.roleList[0].id; //角色
					goodsId = data.id;

				}
			});
		}

		var memberId = "";
		var pageNum = 1;
		var pageSize = 1000;
		var roles = '';
		var cartId = ''; //这里已相当于orderSn
		var status = '';
		$.ajax({
			type: "get",
			url: "http://47.104.13.109/member-service/member/mine/member?token=" + $.cookie('tokenRh'),
			async: false,
			success: function(data) {
				console.log(data);
				memberId = data.id;
				roles = data.roleList;
			}
		});
		$.ajax({
			type: "get",
			url: "http://47.104.13.109/cart-service/selectAll?pageNum=1&pageSize=1000",
			async: true,
			data: {
				userId: memberId,
			},
			success: function(data) {
				console.log(data);
				var a = '';
				var list = data.list.reverse();
				for(var i = 0; i < list.length; i++) {
					// var pic = data.list[i].goodsPic;
					var pic = '../../../images/coalltion/mianbao.jpg';
					if(list[i].goodsGettime != null) {
						a += '<li style="height: 2.77777rem;"><div class="gift_left"><img src="' + list[i].goodsPic + '"/></div><div class="gift_right"><p></p><p>商品名：' + data.list[i].goodsName + '</p><p>积分:' + list[i].goodsIntegral + '</p><p class="active_red" style="position: absolute;bottom: 10px;">领取时间：' + list[i].goodsGettime + '</p></div><div class="duihuan"><img src="../../../images/store/yifahuo.png"/></div></li>'
					} else {
						a += '<li style="overflow: hidden;"><div class="gift_left"><img src="' + list[i].goodsPic + '"/></div><div class="gift_right" ><p></p><p>商品名：' + data.list[i].goodsName + '</p><p>积分:' + list[i].goodsIntegral + '</p><p class="active_red"  style="position: absolute;bottom: 1.625rem;">兑换时间：' + list[i].goodsExchangetime + '</p></div><div class="duihuan"><img src="../../../images/store/duihuan.png"/></div><p style="clear: both;margin-top: 1rem;text-align: center;"><button class="f28_s fahuo" style="padding: 5px 15px;border-radius: 20px;border: 0;background-color: red;color: white;margin-right: 3rem;    margin-top: 15px;"data-a="' + data.list[i].orderSn + '">发货</button><button class="f28_s jishou" style="padding: 5px 15px;border-radius: 20px;border: 1px solid red;background-color: white;color: red;    margin-top: 15px;"data-a="' + data.list[i].orderSn + '">寄售</button></p></li>'
					}

				}
				$('#gift_main').html(a);
			}
		});

		function fahuo(data) {
			//data为订单编号
			//根据订单编号查询购物车
			$.ajax({
				type: "get",
				url: "http://47.104.13.109/order-service/selectbyid?orderSn=" + data,
				async: true,
				success: function(data2) {
					console.log(data2)
					//根据订单编号查询订单id
					$.ajax({
						type: "get",
						url: "http://47.104.13.109:80/cart-service/selectorder",
						async: true,
						data: {
							orderSn: data
						},
						success: function(resC) {
							console.log(resC)
							//领取购物车
							$.ajax({
								type: "post",
								url: "http://47.104.13.109:80/cart-service/hqupdate?CartId=" + resC[0].cartId,
								async: true,
								success: function(data1) {
									console.log(data1)
									// 通过订单id
									$.ajax({
										type: "post",
										url: "http://47.104.13.109:80/order-service/updateorder",
										data: {
											orderId: data2.orderId,
											userAddress: $("#address").val(),
											userName: $("#addName").val(),
											userPhone: $("#phone").val()
										},
										async: true,
										success: function(data3) {
											console.log(data3)
											$.ajax({
												type: "put",
												url: "http://47.104.13.109/information-service/information/send",
												async: true,
												data: {
													inforSendperson: '系统管理员',
													inforContent: '您在礼享商城兑换商品' + data2.goodsName + '已经申请发货啦!!!祝你购物愉快~~',
													inforReceiveperson: $.cookie("memberId"),
												},
												success: function(res3) {
													alert("您的订单已接收稍后给您发货");
													window.location.reload();

												},
												error: function(res4) {
													alert("发送消息出现错误，请联系管理员");

												}

											});

										},
										error: function(error) {
											alert("修改订单状态时时时发生错误")
										}
									});
								},
								error: function(error) {
									alert("领取购物车时时发生错误")
								}
							});

						},
						error: function(error) {
							alert("查询订单id时发生错误")
						}
					});
				},
				error: function(error) {
					alert("查询购物车id时发生错误")
				}
			});

		}

		function zhuanmai(data) {
			var dataId = data; //data为订单编号
			var check = false;
			for(var i = 0; i < roles.length; i++) {
				if(roles[i].id == 'f1' || roles[i].id == 'f2') {
					check = true;
				}
			}
			if(!check) {
				alert('您还不是会员，不能进行转卖!!')
			} else {
				//根据订单编号订单id
				$.ajax({
					type: "get",
					url: "http://47.104.13.109/order-service/selectbyid?orderSn=" + data,
					async: true,
					success: function(data2) {
						console.log(data2)

						//根据订单编号查询购物车
						$.ajax({
							type: "get",
							url: "http://47.104.13.109:80/cart-service/selectorder",
							async: true,
							data: {
								orderSn: data
							},
							success: function(resC) {
								console.log(resC[0].cartId)
								// 修改订单状态
								$.ajax({
									type: "post",
									url: "http://47.104.13.109/cart-service/updatestatus",
									async: true,
									data: {
										Cartid: resC[0].cartId,
									},
									success: function(res) {
										//生成转卖订单
										$.ajax({
											type: "post",
											url: "http://47.104.13.109/order-service/updateresell",
											async: false,
											data: {
												orderId: data2.orderId
											},
											success: function(datao) {
												console.log(datao)
												$.ajax({
													type: "put",
													url: "http://47.104.13.109/information-service/information/send",
													async: true,
													data: {
														inforSendperson: '系统管理员',
														inforContent: '您在礼享商城兑换商品' + resC[0].goodsName + '已经申请转卖啦!!!祝你购物愉快~~',
														inforReceiveperson: $.cookie("memberId"),
													},
													success: function(res3) {
														console.log(res3)
														alert("您的商品已发起寄售");
														window.location.reload();

													},
													error: function(res4) {
														alert("发送消息时出现错误，请联系管理员");

													}

												});
											},
											error: function(error) {
												alert("修改订单状态时出现错误")
											}
										});

										console.log(res);

									},
									error: function(error) {
										alert("修改订单状态时出现错误")
									}
								});
							},
							error: function(error) {
								alert("查询订单时出现错误")
							}
						})
					},
					error: function(error) {
						alert("查询购物车时出现错误")
					}
				})
			}

		}

		function all_product() {
			$.ajax({
				type: "get",
				url: "http://47.104.13.109/cart-service/selectAll?pageNum=1&pageSize=1000",
				async: true,
				data: {
					userId: memberId,
				},
				success: function(data) {
					console.log(data);
					var a = '';
					var list = data.list;
					list = list.reverse();
					for(var i = 0; i < list.length; i++) {
						var pic = '../../../images/coalltion/mianbao.jpg';
						//						if (list[i].goodsResell >= 1) {
						//							a += '<li style="height: 2.77777rem;"><div class="gift_left"><img src="' + list[i].goodsPic + '"/></div><div class="gift_right"><p></p><p>商品名：'+data.list[i].goodsName+'</p><p>积分:' + list[i].goodsIntegral + '</p><p class="active_red" style="position: absolute;bottom: 10px;">兑换时间：' + list[i].goodsExchangetime + '</p></div><div class="duihuan"><img src="../../../images/store/yifahuo.png"/></div><div calss="yijimai" style="position: absolute;top:1rem;color:red;">已寄卖</div></li>'
						//							continue
						//						}
						if(list[i].goodsGettime != null) {
							a += '<li style="height: 2.77777rem;"><div class="gift_left"><img src="' + list[i].goodsPic + '"/></div><div class="gift_right"><p></p><p>商品名：' + data.list[i].goodsName + '</p><p>积分:' + list[i].goodsIntegral + '</p><p class="active_red" style="position: absolute;bottom: 10px;">领取时间：' + list[i].goodsGettime + '</p></div><div class="duihuan"><img src="../../../images/store/yifahuo.png"/></div></li>'
						} else {
							a += '<li style="overflow: hidden;"><div class="gift_left"><img src="' + list[i].goodsPic + '"/></div><div class="gift_right" ><p></p><p>商品名：' + data.list[i].goodsName + '</p><p>积分:' + list[i].goodsIntegral + '</p><p class="active_red"  style="position: absolute;bottom: 1.625rem;">兑换时间：' + list[i].goodsExchangetime + '</p></div><div class="duihuan"><img src="../../../images/store/duihuan.png"/></div><p style="clear: both;margin-top: 1rem;text-align: center;"><button class="f28_s fahuo" style="padding: 5px 15px;border-radius: 20px;border: 0;background-color: red;color: white;margin-right: 3rem;    margin-top: 15px;" data-a="' + data.list[i].cartId + '">发货</button><button class="f28_s jishou" style="    margin-top: 15px;padding: 5px 15px;border-radius: 20px;border: 1px solid red;background-color: white;color: red;"data-a="' + data.list[i].cartId + '">寄售</button></p></li>'
						}

					}
					$('#gift_main').html(a);
				}
			});
			$('#type111').addClass('active_red');
			$('#type222').removeClass('red_border');
			$('#type333').removeClass('red_border');
			$('#type111').addClass('red_border');
			$('#type222').removeClass('active_red');
			$('#type333').removeClass('active_red');
		}

		function wei() {
			$.ajax({
				type: "get",
				url: "http://47.104.13.109/cart-service/noshipments?pageNum=1&pageSize=1000",
				data: {
					userId: memberId,
				},
				async: true,
				success: function(data) {
					console.log(data);
					var a = '';
					var list = data.list;
					list = list.reverse();
					for(var i = 0; i < list.length; i++) {
						if(list[i].goodsGettime != '') {

							//					if(data.list[i].orderStatus==0){
							a += '<li style="overflow: hidden;"><div class="gift_left"><img src="' + list[i].goodsPic + '"/></div><div class="gift_right" ><p></p><p>商品名：' + data.list[i].goodsName + '</p><p>积分:' + list[i].goodsIntegral + '</p><p class="active_red"  style="position: absolute;bottom: 1.625rem;">兑换时间：' + list[i].goodsExchangetime + '</p></div><div class="duihuan"><img src="../../../images/store/duihuan.png"/></div><p style="clear: both;margin-top: 1rem;text-align: center;"><button class="f28_s fahuo" style="padding: 5 15px;border-radius: 20px;border: 0;background-color: red;color: white;margin-right: 3rem;    margin-top: 15px;"data-a="' + data.list[i].cartId + '">发货</button><button class="f28_s jishou" style="    margin-top: 15px;padding: 5px 15px;border-radius: 20px;border: 1px solid red;background-color: white;color: red;"data-a="' + data.list[i].cartId + '">寄售</button></p></li>'
							//					}
						}
					}
					$('#gift_main').html(a);
				}
			});
			$('#type222').addClass('active_red');
			$('#type111').removeClass('active_red');
			$('#type333').removeClass('active_red');
			$('#type222').addClass('red_border');
			$('#type111').removeClass('red_border');
			$('#type333').removeClass('red_border');
		}

		function yi() {
			$.ajax({
				type: "get",
				url: "http://47.104.13.109/cart-service/overhang?pageNum=1&pageSize=1000",
				data: {
					userId: memberId,
				},
				async: true,
				success: function(data) {
					console.log(data);
					var a = '';
					var list = data.list;
					list = list.reverse();
					for(var i = 0; i < list.length; i++) {
						//					if(list[i].orderStatus==1){
						a += '<li style="height: 2.77777rem;"><div class="gift_left"><img src="' + list[i].goodsPic + '"/></div><div class="gift_right"><p></p><p>商品名：' + data.list[i].goodsName + '</p><p>积分:' + list[i].goodsIntegral + '</p><p class="active_red" style="position: absolute;bottom: 10px;">领取时间' + list[i].goodsExchangetime + '</p></div><div class="duihuan"><img src="../../../images/store/yifahuo.png"/></div></li>'
						//					}

					}
					$('#gift_main').html(a);
				}
			});
			$('#type333').addClass('active_red');
			$('#type222').removeClass('active_red');
			$('#type111').removeClass('active_red');
			$('#type333').addClass('red_border');
			$('#type111').removeClass('red_border');
			$('#type222').removeClass('red_border');
		}
		

		function topScroll() {
			document.documentElement.scrollTop = document.body.scrollTop = 0;

		}
		all('')
		//查询我的购物车礼品
		function all(cartStatus) {
			//cartStatus为2 时代表选择已发货
			if(cartStatus == '') {
				$('#type111').addClass('active_red red_border');
				$('#type222').removeClass('active_red red_border');
				$('#type333').removeClass('active_red red_border');
			}
			if(cartStatus == -1) {
				$('#type222').addClass('active_red red_border');
				$('#type111').removeClass('active_red red_border');
				$('#type333').removeClass('active_red red_border');
			}
			if(cartStatus == 2) {
				$('#type333').addClass('active_red red_border');
				$('#type222').removeClass('active_red red_border');
				$('#type111').removeClass('active_red red_border');
			}
			$.ajax({
				type: "get",
				url: "http://47.104.13.109:80/cart-service/selectAll",
				async: true,
				data: {
					pageNum: 1,
					pageSize: 1000,
					userId: $.cookie("memberId")
				},
				success: function(res) {
					console.log(res)
					var list = res.list;
					var a = '';
					for(var i = 0; i < list.length; i++) {
						console.log(list[i].cartStatus)
						console.log(cartStatus)
						//未发货
						if((list[i].cartStatus == -1 && cartStatus == list[i].cartStatus) || (cartStatus == '' && list[i].cartStatus == -1)) {
							a += '<li style="overflow: hidden; padding-bottom: 0.3rem; height:auto;"><div class="gift_left"><img src="' + list[i].goodsPic + '"/></div><div class="gift_right" style=" height:auto; width:65%;" ><p>商品名：' + list[i].goodsName + '</p><p>数量:' + list[i].goodsCount  + '</p><p>积分:' + list[i].goodsIntegral + '</p><p class="active_red" >兑换时间：' + list[i].goodsExchangetime + '</p></div><div class="duihuan"><img src="../../../images/store/duihuan.png"/></div><p style="clear: both;margin-top: 1rem;text-align: center;"><button class="f28_s fahuo" style="padding: 10px 15px;border-radius: 20px;border: 0;background-color: red;color: white;margin-right: 3rem;"data-a="' + list[i].orderSn + '">发货</button><button class="f28_s jishou" style="padding: 10px 15px;border-radius: 20px;border: 1px solid red;background-color: white;color: red;"data-a="' + list[i].orderSn + '">寄售</button></p></li>'
						}
						//代发货
						if((list[i].cartStatus == 0 && cartStatus == list[i].cartStatus) || (cartStatus == '' && list[i].cartStatus == 0) || (cartStatus == 2 && list[i].cartStatus == 0)) {
							
							a += '<li style="overflow: hidden; padding-bottom: 0.3rem; height:auto;"><div class="gift_left"><img src="' + list[i].goodsPic + '"/></div><div class="gift_right" style=" height:auto; width:65%;" ><p>商品名：' + list[i].goodsName + '</p><p>数量:' + list[i].goodsCount  + '</p><p>积分:' + list[i].goodsIntegral + '</p><p class="active_red" >领取时间：' + list[i].goodsExchangetime + '</p></div><div class="duihuan"><img src="../../../images/store/daifukuan.png"/></div><p style="clear: both;margin-top: 1rem;text-align: center;"></p></li>'
						}
						//已发货
						if((list[i].cartStatus == 1 && cartStatus == list[i].cartStatus) || (cartStatus == '' && list[i].cartStatus == 1) || (cartStatus == 2 && list[i].cartStatus == 1)) {
							
							a += '<li style="overflow: hidden; padding-bottom: 0.3rem; height:auto;"><div class="gift_left"><img src="' + list[i].goodsPic + '"/></div><div class="gift_right" style=" height:auto; width:65%;" ><p>商品名：' + list[i].goodsName + '</p><p>数量:' + list[i].goodsCount  + '</p><p>积分:' + list[i].goodsIntegral + '</p><p class="active_red" >领取时间：' + list[i].goodsExchangetime + '</p> <div><span style="width: 30%;display: inline-table;">物流信息：</span><span style=" width:70%; display: inline-table; color:#ccc; border:1px solid #ccc;">' + list[i].goodsIntro + '</span></div> </div><div class="duihuan"><img src="../../../images/store/yifahuo.png"/></div><p style="clear: both;margin-top: 1rem;text-align: center;"></p></li>'
						}
						$('#gift_main').html(a);
					}
					
				},
				error: function(error) {
					alert("查询购物车商品时发生错误");
				}
			});
		}
		//全部
		$(document).on('touchend', '#type111', function() {
			all('')
		})
		//未发货
		$(document).on('touchend', '#type222', function() {
			all(-1)
		})
		//已发货
		$(document).on('touchend', '#type333', function() {
			all(2)
		})

		//发货弹框
		$(document).on('touchend', '.fahuo', function() {
			$('.duihuan_box1').css("display", "block");
			cartId = $(this).attr('data-a');
			console.log(cartId)
			status = 1;
		});
		$('.duihuan_down1 a:last').on('touchend', function() {
			$('.duihuan_box1').css("display", "none");
		});
		//寄卖弹框
		$(document).on('touchend', '.jishou', function() {
			$('.duihuan_box2').css("display", "block");
			cartId = $(this).attr('data-a');
			status = 2;
		});
		$('.duihuan_down2 a:last').on('touchend', function() {
			$('.duihuan_box2').css("display", "none");
		});
		//发货确定或寄卖确定
		$("#fahuoTrue").on('touchend', function() {
			//正则验证
			var zhengzphoone = /^1[3|4|5|7|8][0-9]{9}$/;
			if($("#addName").val() == '') {
				return alert("请输入联系人姓名");
			}
			if($("#phone").val() == '') {
				return alert("请输入联系电话");
			}
			if(!zhengzphoone.test($("#phone").val())) {
				return alert("请输入正确的手机号码")
			}
			if($("#address").val() == '') {
				return alert("请输入收货地址");
			}
			console.log(cartId)
			fahuo(cartId);
		})

		//取消编辑收货地址清空输入框
		$("#fahuoQuxiao").on('touchend', function() {
			$('.form-control').val('')
		})
		$("#Besure2").on('touchend', function() {
			zhuanmai(cartId);
		})
	</script>

</html>